call common.bat

IF "%1" == "" goto else
SET BuildConfiguration=%1
goto endif
:else
SET BuildConfiguration=Release
:endif

echo Cleaning previous normal and exp hive GAX/GAT extensions...

rmdir /s /q "%LocalAppData%\Microsoft\VisualStudio\10.0Exp\Extensions\Microsoft\Regex Editor"
rmdir /s /q "%LocalAppData%\Microsoft\VisualStudio\10.0Exp\Extensions\Microsoft\Image Insertion"
rmdir /s /q "%LocalAppData%\Microsoft\VisualStudio\10.0Exp\Extensions\Microsoft\IntelliSense Presenter"

echo Building Regex Editor
call msbuild "Regex Editor\src\RegexEditor.sln" /target:Rebuild /p:Configuration=%BuildConfiguration%
if errorlevel 1 goto :error

echo Image Insertion Editor
call msbuild ImageInsertion\src\ImageInsertion.sln /target:Rebuild /p:Configuration=%BuildConfiguration%
if errorlevel 1 goto :error

echo IntelliSensePresenter Editor
call msbuild IntelliSensePresenter\src\IntelliSensePresenter.sln /target:Rebuild /p:Configuration=%BuildConfiguration%
if errorlevel 1 goto :error


echo Build success
goto :exit

:error
echo Build failed

:exit
